package com.ivr.cm.dao.impl;

import org.apache.log4j.Logger;
import org.springframework.jdbc.core.support.JdbcDaoSupport;

import com.ivr.cm.dao.IListBlackDao;
import com.ivr.cm.util.BaseUtil;
/**
 * 黑名单数据实现
 * @author liugeng
 * @date 2015-12-15
 * @version 1.0
 */
public class ListBlackDaoImpl extends JdbcDaoSupport implements IListBlackDao {
	private static Logger logger = Logger.getLogger(ListBlackDaoImpl.class);
	/**根据用户查找黑名单是否存在记录*/
	@Override
	public boolean getListBlackList(String mobile, String sp_code) {
		String sql = "select count(1) from tb_ivr_list_black where status = '1' and mobile = ? and sp_code = ?";
		Object[] param = new Object[]{mobile, sp_code};
		logger.info(String.format("[%s]根据用户查找是否在黑名单列表里[%s]", mobile, BaseUtil.logSQL(sql, param)));
		
		int count = this.getJdbcTemplate().queryForInt(sql, param);
		if(count > 0){
			return true;
		}
		return false;
	}
}
